package com.phantasy.scene.sceneUnit.baseUnit.things
{
	import com.phantasy.scene.sceneManager.LoopManager;
	
	import flash.utils.Dictionary;

	public class ThingFrame
	{
		private static var _instance:ThingFrame;
		private static var funs:Dictionary = new Dictionary();
		
		public function ThingFrame()
		{
			LoopManager.addToFrame(this, this.loop);
		}
		
		public static function getInstance():ThingFrame
		{
			if (_instance == null)
			{
				_instance = new (ThingFrame)();
			};
			return (_instance);
		}
		
		
		public function loop():void
		{
			var _local1:Function;
			for each (_local1 in funs)
			{
				_local1.call();
			};
		}
		
		public function add(_arg1:String, _arg2:Function):void
		{
			if (!funs.hasOwnProperty(_arg1))
			{
				funs[_arg1] = _arg2;
			};
		}
		
		public function remove(_arg1:String):void
		{
			if (funs.hasOwnProperty(_arg1))
			{
				funs[_arg1] = null;
				delete funs[_arg1];
			};
		}
	}
}